package Tester;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

import spaceCraft.*;

/**
 * Created by IntelliJ IDEA.
 * User: anton
 * Date: 19.04.12
 * Time: 8:37
 * To change this template use File | Settings | File Templates.
 */
public class SpacePortTest {

    private int ACCELERATION = 900;
    SpacePort hangar18;
    private Engine shipEngine;
    private SpaceShip ship;

    @Before
    public void setUp() {
        hangar18 = new SpacePort();
        shipEngine = new Engine(new ProductInfo("Foo", "kaka"), ACCELERATION);
        ship = new SpaceShip(new ProductInfo("JEtPack", "FireFly"), shipEngine);
    }

    @Test
    public void buildNewShipTest() {
        assertTrue(hangar18.addNewShipToHangar(ship));
    }

    @Test
    public void tryToAddPhantomShip() {
        assertFalse(hangar18.addNewShipToHangar(null));
    }

    @Test
    public void sellShipTest() {
        assertNotNull(hangar18.sellSpecifiedShip(ship));
    }

    @Test
    public void tryToSellPhantomShip() {
        assertFalse(hangar18.sellSpecifiedShip(null));
    }

    @Test
    public void shipIsPresent() {
        hangar18.addNewShipToHangar(ship);
        assertTrue(hangar18.isInHangar(ship));
    }

    @Test
    public void checkForPhantomShip() {
        hangar18.addNewShipToHangar(ship);
        assertFalse(hangar18.isInHangar(null));
    }
}
